package com.wujiayu.retry.controller;

import com.wujiayu.retry.annotation.NoRepeatSubmit;
import com.wujiayu.retry.annotation.RequestLimit;
import com.wujiayu.retry.service.impl.RetryServiceTestImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: 重试机制控制器
 * @Author: WuJiaYu
 * @Date: 2021/3/11 3:42 下午
 * @Version: 1.0
 */
@RestController
@RequestMapping("/retry")
@RequestLimit(maxCount = 2,second = 10)
public class RetryController {
    @Autowired
    private RetryServiceTestImpl retryServiceTest;

    @GetMapping("/test")
    @RequestLimit(maxCount = 2,second = 10)
    @NoRepeatSubmit
    public String testRetry(int code) throws Exception {
        int s = retryServiceTest.retryServiceTest(code);
        return "result" + s;
    }
}
